package LeetCode.leetcode70;

import java.util.Arrays;

public class Review1 {
    public int climbStairs(int n) {
        int[] memo = new int[n + 1];
        Arrays.fill(memo, -1);
        return recursion(n,memo);
    }
    public int recursion(int n, int[] memo) {
        if (memo[n] != -1) {return memo[n];}
        if (n <= 1) {
            memo[n] = 1;
            return 1;
        }
        memo[n] =  recursion(n - 1, memo) + recursion(n - 2, memo);
        return memo[n];
    }
}
